<?php

namespace falcon5\inc\WPProviders;

use falcon5\inc\Base\ServiceProviderInterface;
use falcon5\inc\Pages\Settings;

/**
 * @desc 后台页面
 * Class AddAdminMenuPage
 * @package falcon5\inc\ServiceProvider
 */
class AdminMenuPage implements ServiceProviderInterface
{

    /**
     * @return string[]
     * @desc
     */
    public static function getPages(): array
    {
        return [
            Settings::class,
        ];
    }

    public function register()
    {
        foreach (self::getPages() as $class) {
            $object = self::instantiate($class);
            if (method_exists($object, 'register')) {
                $object->register();
            }
        }

    }


    public static function instantiate($class)
    {
        return new $class;
    }
}